import Vue from 'vue'
import Vuex from 'vuex'

import app from './modules/app.js';
import user from './modules/user.js';
import lang from './modules/lang.js';


import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)

export default new Vuex.Store({
  plugins: [createPersistedState()],
  getters: {
    sidebar: state => state.app.sidebar,
    account: state => state.user.account,
    username: state => state.user.username,
    type: state => state.user.type,
    token: state => state.user.token,
    locale: state => state.lang.locale
  },
  modules: {
    app, user, lang
  }
})
